<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>字符方法</title>
  </head>
  <body>
  <script type="text/javascript">
    var str="hello world"; 
    console.log(str.charAt(1));//e 
    console.log(str.charCodeAt(1));//101 
    //还可以使用方括号加数字索引来访问字符串中特定的字符 
    console.log(str[1]);//e 
  </script>
  </body>
</html>
